package com.youle.youleservice.greedao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.youle.youleservice.bean.City;
import com.youle.youleservice.bean.Location;
import com.youle.youleservice.bean.Province;

import com.youle.youleservice.greedao.CityDao;
import com.youle.youleservice.greedao.LocationDao;
import com.youle.youleservice.greedao.ProvinceDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig cityDaoConfig;
    private final DaoConfig locationDaoConfig;
    private final DaoConfig provinceDaoConfig;

    private final CityDao cityDao;
    private final LocationDao locationDao;
    private final ProvinceDao provinceDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        cityDaoConfig = daoConfigMap.get(CityDao.class).clone();
        cityDaoConfig.initIdentityScope(type);

        locationDaoConfig = daoConfigMap.get(LocationDao.class).clone();
        locationDaoConfig.initIdentityScope(type);

        provinceDaoConfig = daoConfigMap.get(ProvinceDao.class).clone();
        provinceDaoConfig.initIdentityScope(type);

        cityDao = new CityDao(cityDaoConfig, this);
        locationDao = new LocationDao(locationDaoConfig, this);
        provinceDao = new ProvinceDao(provinceDaoConfig, this);

        registerDao(City.class, cityDao);
        registerDao(Location.class, locationDao);
        registerDao(Province.class, provinceDao);
    }
    
    public void clear() {
        cityDaoConfig.clearIdentityScope();
        locationDaoConfig.clearIdentityScope();
        provinceDaoConfig.clearIdentityScope();
    }

    public CityDao getCityDao() {
        return cityDao;
    }

    public LocationDao getLocationDao() {
        return locationDao;
    }

    public ProvinceDao getProvinceDao() {
        return provinceDao;
    }

}
